package mk.jug.academy.paging;

import mk.jug.academy.testing.bdd.Behavior;
import mk.jug.academy.util.Utils;

import com.googlecode.instinct.marker.annotate.Specification;

/**
 * Simple, 'sanity-like' test for the calculation part of
 * the paging functionality.
 *
 * @author Ice.Penov
 */
public class PagingCalculation extends Behavior {
	
	@Specification
	public void calculatePagingBoundaries() {
		int totalRecords = 10;
		int itemsPerPage = 3;
		
		//number of pages.
		expect.that(Utils.getPageNumber(itemsPerPage, totalRecords)).isEqualTo(4);
		//page 1.
		expect.that(Utils.calculateStart(1, itemsPerPage)).isEqualTo(0);
		//page 2.
		expect.that(Utils.calculateStart(2, itemsPerPage)).isEqualTo(3);
	}
	
	

}
